﻿using PermissionAuthenticationDemo.Common.Enum;

namespace PermissionAuthenticationDemo.Common
{
    public class LoginResult<T>
    {
        public ResultStatus status { get; set; }

        public string message { get; set; }

        public string token { get; set; }

        public T data { get; set; }

        public LoginResult(ResultStatus status, string message, string token, T data)
        {
            this.status = status;
            this.message = message;
            this.token = token;
            this.data = data;
        }

        public static LoginResult<T> Success(T data, string message, string token)
        {
            return new LoginResult<T>(ResultStatus.Success, message, token, data);
        }

        public static LoginResult<T> Error(T data, string message = "登录失败")
        {
            return new LoginResult<T>(ResultStatus.Error, message, null, data);
        }
    }
}
